<?php
include($classes_path.'/class.pageFetcher.php');
include_once($classes_path.'/class.simplepie.inc');
$fetcher = new pageFetcher();
$fetcher->set_page($pageid);
$fetcher->set_id($id);
$title = $fetcher->get_title();
$summary = $fetcher->get_summary();
$body = $fetcher->get_body();
$feedUrl = $fetcher->get_feed();

if(!empty($title)) {
    print('<h1>'.$title.'</h1>');
    if($_SESSION['adminrights'] == true) {
        print('<p class="nomarg"><a href="page/8/admin/apage/edit/epage/'.$pageid.'">Edit</a> | <a href="../includes/delete.inc.php?pageid='.$pageid.'" onclick="javascript:return confirm('.$delPromt.')">Delete</a></p>');
    }
}
if(!empty($summary)) {
    print('<p>'.nl2br($summary).'</p>');
}
if(!empty($body)) {
    print('<p>'.nl2br($body).'</p>');
}

if( !empty($feedUrl)) {
    $feed = new SimplePie($feedUrl);
    $feed->handle_content_type();
    foreach($feed->get_items() as $item) {
        print('<h3><a href="'.$item->get_permalink().'">'.$item->get_title().'</a></h3>');
        print('<p>' . $item->get_date() . '</p>');
        print('<p>' . $item->get_content() . '</p>');
    }
}
?>
